package com.nisco.dms.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.validator.constraints.NotBlank;

@Entity
@Table(name = "sm_sql_column")
public class SqlColumn extends CoreEntity {
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "tabId")
	private SqlTable sqlTable;
	@NotBlank
	@Column(length = 100)
	private String colName;
	@NotBlank
	@Column(length = 50)
	private String colType;
	@NotNull
	@Max(value=2000)
	@Column(length = 8)
	private Integer colSize;
	@Column(length = 10)
	private String colPrikey;
	@Column(length = 200)
	private String colDes;
	@Column(length = 200)
	private String memo;
	@Column(length = 10)
	private String colNull;
	public SqlTable getSqlTable() {
		return sqlTable;
	}

	public void setSqlTable(SqlTable sqlTable) {
		this.sqlTable = sqlTable;
	}

	public String getColName() {
		return colName;
	}

	public void setColName(String colName) {
		this.colName = colName;
	}

	public String getColType() {
		return colType;
	}

	public void setColType(String colType) {
		this.colType = colType;
	}

	public Integer getColSize() {
		return colSize;
	}

	public void setColSize(Integer colSize) {
		this.colSize = colSize;
	}

	public String getColPrikey() {
		return colPrikey;
	}

	public void setColPrikey(String colPrikey) {
		this.colPrikey = colPrikey;
	}

	public String getColDes() {
		return colDes;
	}

	public void setColDes(String colDes) {
		this.colDes = colDes;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public String getColNull() {
		return colNull;
	}

	public void setColNull(String colNull) {
		this.colNull = colNull;
	}

	/**
	 * reflectionToString将对象输出为string类型。
	 */
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

}
